package com.xjprojectc.uitl.pager;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ComponentTagSupport;

import com.opensymphony.xwork2.util.ValueStack;

public class PageTag extends ComponentTagSupport {

	private String currentPage;// 当前页码
	private String totalPage;// 总页数
	private String pageSize;// 每页记录数
	private String styleClass;
	private String theme;
	private String url;
	private String urlType;

	public void setUrlType(String urlType) {
		this.urlType = urlType;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public void setTheme(String theme) {
		this.theme = theme;
	}

	public void setStyleClass(String styleClass) {
		this.styleClass = styleClass;
	}

	public Component getBean(ValueStack arg0, HttpServletRequest arg1,
			HttpServletResponse arg2) {
		return new Pages(arg0, arg1);
	}

	protected void populateParams() {
		super.populateParams();

		Pages pages = (Pages) component;
		pages.setCurrentPage(currentPage);
		pages.setTotalPage(totalPage);
		pages.setStyleClass(styleClass);
		pages.setTheme(theme);
		pages.setUrl(url);
		pages.setUrlType(urlType);
		pages.setPageSize(pageSize);

	}

	public void setCurrentPage(String currentPage) {
		this.currentPage = currentPage;
	}

	public void setTotalPage(String totalPage) {
		this.totalPage = totalPage;
	}

	public void setPageSize(String pageSize) {
		this.pageSize = pageSize;
	}
}
